<template>
  <view class="setting-container">
    <button type="primary" @click="logout">退出登录</button>
  </view>
</template>

<script setup>
import { ref } from 'vue'

const logout = () => {
  uni.removeStorageSync('token')
  uni.removeStorageSync('userInfo')
  uni.showToast({ title: '已退出登录', icon: 'success' })
  setTimeout(() => {
    uni.reLaunch({ url: '/pages/index/index' }) // 这里路径要和你的项目实际一致
  }, 800)
}
</script>

<style scoped>
.setting-container {
  padding: 40rpx;
  display: flex;
  justify-content: center;
}
</style>